#include <iostream>
#include <functional>
#include <unistd.h>

class Worker
{
public:
    Worker()
    {
    }
    void choose(int n)
    {
        switch (n)
        {
        case 1:
            std::cout << "Lording Config....\n";
            sleep(1);
            break;
        case 2:
            std::cout << "Receving Request...\n";
            sleep(1);
            break;
        case 3:
            std::cout << "Downloading resource...\n";
            sleep(1);
            break;
        default:
            std::cout << "None Behavier\n";
            break;
        }
    }
    void Work()
    {
        int n = 0;
        while (1)
        {
            ssize_t n = ::read(0, &n, sizeof(n));
            if (n > 0)
            {
                choose(n);
            }
            else if (n == 0)
            {
                std::cout << "father is quit, me too" << std::endl;
                break;
            }
            else
            {
                std::cout << "read error\n"
                          << std::endl;
                break;
            }
        }
    }
    ~Worker()
    {
    }

private:
};